package com.skyolder.crutch.word.raw;

import java.util.ArrayList;
import java.util.LinkedList;

import com.skyolder.crutch.error.GrammarError;

public class BufferCharPiper {
	private CharPiper  charPiper=null;
	private LinkedList<Character> list=new LinkedList<Character>();
	public BufferCharPiper(CharPiper charPiper){
		this.charPiper=charPiper;
	}
	public  char nextChar() throws GrammarError {
		if(list.size()>0){
			Character character=list.removeFirst();
			return character;
		}
		return charPiper.nextChar();
	}
	public char peekChar() throws GrammarError{
		char c=charPiper.nextChar();
		list.addLast(c);
		return c;
	}
	
}
